<template>
    <video id="player" width="414" height="270" preload="auto" playsinline webkit-playsinline></video>
  </template>
  
  <script setup>
  
  import TCPlayer from 'tcplayer.js';
  import 'tcplayer.js/dist/tcplayer.min.css';
  import 'tcplayer.js/dist/libs/hls.min.1.1.7'
  import 'tcplayer.js/dist/libs/flv.min.1.6.4'
  import 'tcplayer.js/dist/tcplayer.v5.2.0.min.js'
  
  let player;
  
  onMounted(() => {
    player = TCPlayer('player', {
      sources: [{
        src: 'webrtc://www.demo.play.galen.asia/live/test', // 播放地址
      }],
      licenseUrl: 'https://license.vod2.myqcloud.com/license/v2/1335840188_1/v_cube.license', // license 地址
    });
  
    player.on('error', (err) => {
      console.error('播放器错误:', err);
    });
  });
  
  onUnmounted(() => {
    if (player) {
      player.destroy();
    }
  });
  </script>